FROM golang:1.14

RUN GOCACHE=OFF

# Set private libray
RUN go env -w GOPRIVATE=gitlab.bj.sensetime.com/taoshumin_vendor

# Set insecure 
RUN go env -w GOINSECURE=gitlab.bj.sensetime.com/taoshumin_vendor

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy everything from the current directory to the Working Directory inside the container
COPY . .

# Set Git SSH
ADD .ssh/id_rsa /root/.ssh/id_rsa
ADD .ssh/id_rsa.pub /root/.ssh/id_rsa.pub
ADD .ssh/known_hosts /root/.ssh/known_hosts

#RUN apk add git
RUN git config --global http.extraheader "PRIVATE-TOKEN: AKqvFGg7ofJajiKMssTL"

RUN git config --global url."git@gitlab.bj.sensetime.com:".insteadOf "http://gitlab.bj.sensetime.com/"

# Build the Go app
RUN go build -o main .

# Expose port 8080 to the outside world
EXPOSE 8080

#ENTRYPOINT ["/app"]

# Command to run the executable
CMD ["./main"]
